import { Style } from 'ol/style';
import Icon from 'ol/style/Icon';
import Fill from 'ol/style/Fill';
import Circle from 'ol/style/Circle';
import Text from 'ol/style/Text';
import Stroke from 'ol/style/Stroke';




/**
* 各组件的默认层级  基地<分区<地块<文字<地块中心圆图<设备组件<基地图标
*/


var PARTITIONS_Z = 760;
if (partitions_z != "") PARTITIONS_Z = parseInt(partitions_z);


var FACILITYS_Z = 740;
var partitions_z = 1000;
 

var styles = {
    
 
   
    
    /**
     * 画房间的样式
     */
    drawRoomStyle: new Style({
        stroke: new Stroke({
            color: "#C2C544",
            lineDash: [10, 10],
            width: 2
        }),
        fill: new Fill({
            color: "rgba(194,197,68, 0.45)"
        }),
    }),
    roomStyle: new Style({
        stroke: new Stroke({
            color: "#C2C544",
            width: 2
        }),
        fill: new Fill({
            color: "rgba(194,197,68, 0.45)"
        }),
    }),

 

    
    
    /**
     * 大田的样式
     */
    fieldInfoStyle: function (name, src) {
        var style = new Style({
            image: new Icon( /** @type {olx.style.IconOptions} */({
                anchor: [0.5, 1],
                anchorXUnits: 'fraction',
                anchorYUnits: 'fraction',
                src: src,
                rotateWithView: true
            })),
            text: new Text({
                font: "16px 宋体",
                fill: new Fill({
                    color: "#fff"
                }),
                textBaseline: "top",
                text: name
            })
        })
        return style;
    },
    /**
     * 文字的样式
     */
    textStyle: function (name) {
        var white = [255, 255, 255, 1];
        var blue = [0, 153, 255, 1];
        var width = 3;
        var style = new Style({
            image: new Circle({
                radius: width * 2,
                fill: new Fill({
                    color: blue
                }),
                stroke: new Stroke({
                    color: white,
                    width: width / 2
                })
            }),
            text: new Text({
                font: "16px 宋体",
                fill: new Fill({
                    color: "#fff"
                }),
                textBaseline: "top",
                text: name,
                offsetY: 6
            }),
            zIndex: FACILITYS_Z + 1
        })
        return style;
    },
    
   
}



export default styles;